#if !defined(APPLICATION_H)
#define APPLICATION_H

#include <d3d11.h>

class CD3D11EnumAdapterInfo;
class CD3D11EnumDeviceInfo;
struct DXUTDeviceSettings;

namespace MandelShader
{
	class IFramework;

	class IApplication
	{
	public:
		virtual ~IApplication() { }

		virtual void Startup() = 0;
		virtual void Shutdown() = 0;

		virtual bool IsDeviceAcceptable(CD3D11EnumAdapterInfo const *adapterInfo, UINT output, CD3D11EnumDeviceInfo const *deviceInfo,
			DXGI_FORMAT backBufferFormat, bool windowed) = 0;
		virtual bool ModifyDeviceSettings(DXUTDeviceSettings *deviceSettings) = 0;
		virtual HRESULT OnCreateDevice(ID3D11Device *device, DXGI_SURFACE_DESC const *backBufferSurfaceDesc) = 0;
		virtual HRESULT OnResizedSwapChain(ID3D11Device *device, IDXGISwapChain *swapChain, DXGI_SURFACE_DESC const *backBufferSurfaceDesc) = 0;
		virtual void OnFrameMove(double currentTime, float elapsedTime) = 0;
		virtual void OnFrameRender(ID3D11Device *device, ID3D11DeviceContext *immediateContext, double currentTime, float elapsedTime) = 0;
		virtual void OnReleasingSwapChain() = 0;
		virtual void OnDestroyDevice() = 0;
		virtual LRESULT MsgProc(HWND window, UINT msg, WPARAM wp, LPARAM lp, bool *noFurtherProcessing) = 0;
		virtual void OnKeyboard(UINT keyChar, bool keyDown, bool altDown) = 0;
		virtual void OnMouse(bool leftButtonDown, bool rightButtonDown, bool middleButtonDown, bool sideButton1Down, bool sideButton2Down, int mouseWheelDelta, int x, int y) = 0;
		virtual bool OnDeviceRemoved() = 0;
	};

	IApplication *CreateApplication(IFramework *framework);
}

#endif
